package com.sj.sync;

import org.openjdk.jol.info.ClassLayout;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class Test {
    static Object generate() {
        Map<String, Object> map = new HashMap<>();
        map.put("a", new Integer(1));
        map.put("b", "b");
        map.put("c", new Date());

        for (int i = 0; i < 10; i++) {
            map.put(String.valueOf(i), String.valueOf(i));
        }
        return map;
    }
    public static void main(String[] args) throws InterruptedException {
        Thread.sleep(5000);
        Object o = new Object();
        synchronized (o) {
        }
        for (int i = 0; i < 1; i++) {
            Thread t = new Thread(() -> {
                print(o);
            });
            t.start();
        }
    }

    public static void print(Object o) {
        synchronized (o){
            System.out.println(ClassLayout.parseInstance(o).toPrintable());
        }
    }


}
